/**
 * <copyright>
 * </copyright>
 *

 */
package org.eclipse.gittab.gitTabDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.gittab.gitTabDsl.GitTabDslPackage;
import org.eclipse.gittab.gitTabDsl.GuitarStr;
import org.eclipse.gittab.gitTabDsl.Note;
import org.eclipse.gittab.gitTabDsl.NoteWrapper;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Note</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.eclipse.gittab.gitTabDsl.impl.NoteImpl#getNote <em>Note</em>}</li>
 *   <li>{@link org.eclipse.gittab.gitTabDsl.impl.NoteImpl#getGitString <em>Git String</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class NoteImpl extends SoundImpl implements Note
{
  /**
   * The cached value of the '{@link #getNote() <em>Note</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getNote()
   * @generated
   * @ordered
   */
  protected NoteWrapper note;

  /**
   * The cached value of the '{@link #getGitString() <em>Git String</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getGitString()
   * @generated
   * @ordered
   */
  protected GuitarStr gitString;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected NoteImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return GitTabDslPackage.Literals.NOTE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NoteWrapper getNote()
  {
    return note;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetNote(NoteWrapper newNote, NotificationChain msgs)
  {
    NoteWrapper oldNote = note;
    note = newNote;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GitTabDslPackage.NOTE__NOTE, oldNote, newNote);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setNote(NoteWrapper newNote)
  {
    if (newNote != note)
    {
      NotificationChain msgs = null;
      if (note != null)
        msgs = ((InternalEObject)note).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GitTabDslPackage.NOTE__NOTE, null, msgs);
      if (newNote != null)
        msgs = ((InternalEObject)newNote).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GitTabDslPackage.NOTE__NOTE, null, msgs);
      msgs = basicSetNote(newNote, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GitTabDslPackage.NOTE__NOTE, newNote, newNote));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuitarStr getGitString()
  {
    if (gitString != null && gitString.eIsProxy())
    {
      InternalEObject oldGitString = (InternalEObject)gitString;
      gitString = (GuitarStr)eResolveProxy(oldGitString);
      if (gitString != oldGitString)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, GitTabDslPackage.NOTE__GIT_STRING, oldGitString, gitString));
      }
    }
    return gitString;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuitarStr basicGetGitString()
  {
    return gitString;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setGitString(GuitarStr newGitString)
  {
    GuitarStr oldGitString = gitString;
    gitString = newGitString;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GitTabDslPackage.NOTE__GIT_STRING, oldGitString, gitString));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case GitTabDslPackage.NOTE__NOTE:
        return basicSetNote(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case GitTabDslPackage.NOTE__NOTE:
        return getNote();
      case GitTabDslPackage.NOTE__GIT_STRING:
        if (resolve) return getGitString();
        return basicGetGitString();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case GitTabDslPackage.NOTE__NOTE:
        setNote((NoteWrapper)newValue);
        return;
      case GitTabDslPackage.NOTE__GIT_STRING:
        setGitString((GuitarStr)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case GitTabDslPackage.NOTE__NOTE:
        setNote((NoteWrapper)null);
        return;
      case GitTabDslPackage.NOTE__GIT_STRING:
        setGitString((GuitarStr)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case GitTabDslPackage.NOTE__NOTE:
        return note != null;
      case GitTabDslPackage.NOTE__GIT_STRING:
        return gitString != null;
    }
    return super.eIsSet(featureID);
  }

} //NoteImpl
